package com.rpoonolly.simplegame.core;

import java.util.ArrayList;
import java.util.List;

public class GameEngine {
	protected List<GameLogicProcessor> processors;
	protected List<Renderer> renderers;
	
	public GameEngine() {
		this(new ArrayList<GameLogicProcessor>(), new ArrayList<Renderer>());
	}
	
	public GameEngine(List<GameLogicProcessor> processors, List<Renderer> renderers) {
		this.processors = processors;
		this.renderers = renderers;
	}
	
	public void addProcessor(GameLogicProcessor processor) {
		processors.add(processor);
	}
	
	public void addRenderer(Renderer renderer) {
		renderers.add(renderer);
	}
	
	public void process() {
		for(GameLogicProcessor processor : processors)
			processor.process();
	}
	
	public void render() {
		for(Renderer renderer : renderers)
			renderer.render();
	}
}
